package Store;

public class ItemChange {
	private String itemChangeID = "";
	private String itemID = "";
	private String typeOfChange = "";
	private static Integer idGenerator = 0;
	
	public synchronized static String getUniqueItemChangeID(){
		return ((Integer) idGenerator++).toString();
	}
	
	public ItemChange(String itemID, Integer i){
		if(i == 1){
			this.setTypeOfChange("ADD");
		}
		else if( i == 2){
			this.setTypeOfChange("DELETE");
		}
		else if(i == 3){
			this.setTypeOfChange("DISCOUNT");
		}
		else if(i == 4){
			this.setTypeOfChange("RDISCOUNT");
		}
		else{
			throw new IllegalArgumentException("The type of change integer value is incorrect!!");
		}
		this.setItemID(itemID);
		this.setItemChangeID(getUniqueItemChangeID());
	}
	
	public void setItemID(String itemID) {
		this.itemID = itemID;
	}
	
	public String getItemID() {
		return itemID;
	}
	
	private void setTypeOfChange(String typeOfChange) {
		this.typeOfChange = typeOfChange;
	}
	
	public String getTypeOfChange() {
		return typeOfChange;
	}

	public void setItemChangeID(String itemChangeID) {
		this.itemChangeID = itemChangeID;
	}

	public String getItemChangeID() {
		return itemChangeID;
	}
	
}
